//
//  TabController.m
//  SinaWeiBo
//
//  Created by 姚建强 on 15-2-11.
//  Copyright (c) 2015年 com.yjq. All rights reserved.
//

#import "TabController.h"
#import "TabView.h"
#import "TabItemModel.h"
@interface TabController ()<TabViewDelegate>
{
    TabView * tabView;
}
@end

@implementation TabController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (id)initWithItems:(NSArray*)items{

    self=[super init];
    if (self) {
        [self.view setBackgroundColor:[UIColor grayColor]];
        tabView=[[TabView alloc] initWithFrame:CGRectMake(0, TABY, [UIScreen mainScreen].bounds.size.width, TABHIGHT) AndItemModels:items];
        tabView.delegate=self;
       
    }
    
    [self.view addSubview:tabView];
    return self;
}
-(id)init{
    NSArray* array;
    TabItemModel* model1=[[TabItemModel alloc]initWithTitle:@"首页" AndImagePath:@"home.png" ];
    TabItemModel* model2=[[TabItemModel alloc]initWithTitle:@"消息" AndImagePath:@"message.png" ];
    TabItemModel* model3=[[TabItemModel alloc]initWithTitle:@"发现" AndImagePath:@"magnifier.png" ];
    TabItemModel* model4=[[TabItemModel alloc]initWithTitle:@"我" AndImagePath:@"person.png"];
    array=[NSArray arrayWithObjects:model1,model2,model3,model4, nil];
    self=[self initWithItems:array];
    
    
    return self;

}


-(void)tabviewSeletedItem:(NSInteger *)index{

    NSLog(@"index=%d",index);
}
@end
